/**
 * @summary 频道模块
 * @author 喜喜
 */
import * as searchApi from '@/api/search';
export default {
  // 我是模块
  namespaced: true,
  state: {
    SearchList: [],
    SearchResult: []
  },

  mutations: {
    SET_SEARCH_LIST(state, newValue) {
      state.SearchList = newValue;
    },
    SET_SEARCH_RESULT(state, newValue) {
      state.SearchResult = newValue;
    },
  },

  actions: {
    async updateSearchList(context, searchValue) {
      const res = await searchApi.getSearchList(searchValue);
      context.commit('SET_SEARCH_LIST', res);
    },
    async updateSearchResult(context, searchValue) {
      const res = await searchApi.getSearchResult(searchValue);
      context.commit('SET_SEARCH_RESULT', res);
    }
  },

}
